﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TTBusiness.ClassDB;
using TTBusiness.DB_Linq;
using TTController;
using Telerik.Web.UI;
using System.Drawing;

namespace TTMarketing.CameraUserControl.LeftMenu
{
    public partial class ModuleLeft_LeftMenu : System.Web.UI.UserControl
    {

        clsBSCateProduct ty = new clsBSCateProduct();
        clsBSTypeProduct pr = new clsBSTypeProduct();
        clsBSCateFactory cf = new clsBSCateFactory();
        clsCTProcess objProcess = new clsCTProcess();

        protected void Page_Init(object sender, EventArgs e)
        {
           
                load_TypeProduct();
            
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            
            
        }
       
        [Obsolete("ham cu oai")]
        private void load_TypeProduct() {
            RadMenu myMenu = new RadMenu();
            Color c = ColorTranslator.FromHtml("#EC6F24");
            Color c2 = ColorTranslator.FromHtml("#F1EEEE");
            foreach (tblTypeProduct item in pr.getStatus(true))
            {
               // treeMenu.Nodes
                RadPanelItem node = new RadPanelItem();
                node.Text = item.Name;
                //node.Enabled = false;
                node.Expanded = true;
                node.Font.Size = 9;
                node.Font.Bold = true;
                node.BackColor = c;
                node.ForeColor = Color.White ;
                foreach (tblCateProduct type in ty.getByType(true, item.ID))
                {
                    #region 
                    RadPanelItem child = new RadPanelItem();
                    child.Text = type.Name;   
                    child.NavigateUrl = "~/san-pham.aspx?factoryid="+type.ID+"&name="+type.Name;
                    child.ImageUrl = "~/Styles/Images/2.gif";
                    child.SelectedImageUrl = "~/Styles/Images/1.gif";
                    child.ForeColor = Color.Black;
                    child.BorderWidth = 1;
                    child.BorderColor = Color.White;
                    child.BackColor = c2;
                    child.Value = "menu";
                    
                    
                    //myMenu.Width = Unit.Percentage(100);
                    //myMenu.Skin = "Outlook";
                    //myMenu.Flow = ItemFlow.Horizontal;
                    //RadMenuItem i = new RadMenuItem("Hello");
                    //myMenu.Items.Add(i);
                    //RadMenuItem i2 = new RadMenuItem("Hello2");
                    //i.Items.Add(i2);
                    //RadMenuItem i3 = new RadMenuItem("Hello3");
                    //i2.Items.Add(i3);

                    //child.Controls.Add(myMenu);
                    //foreach (RadMenuItem myItems in myMenu.GetAllItems())
                    //{
                    //    myItems.Width = Unit.Percentage(100);
                    //}
                   
                    foreach (tblManuFactory f in objProcess.getFactoryByCateNotInNoCate(type.ID,3))
                    {
                        RadPanelItem child2 = new RadPanelItem();
                        child2.Text = f.Name;
                        child2.NavigateUrl = "~/san-pham.aspx?cateid=" + f.ID + "&name=" + type.Name;
                        child2.Font.Size = 8;
                        child2.ForeColor = Color.Black;
                        child2.ImageUrl = "~/Styles/Images/3.gif";
                        child.Items.Add(child2);
                    }
                    #endregion
                    node.Controls.Add(myMenu);
                    node.Items.Add(child);
                }
                RadPanelBar1.Items.Add(node);
            }
        }




    }
}